<!--
 * @Author: syb 903923381@qq.com
 * @Date: 2022-06-02 21:05:54
 * @LastEditors: syb 903923381@qq.com
 * @LastEditTime: 2022-06-02 21:48:14
 * @FilePath: \canvas\6.圆弧和圆.html
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->


<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <canvas id="canvas" width="1000px" height="1000px"></canvas>
    <script>
        //开启canvas代码提示
        /** @type {HTMLCanvasElement} */
        // 1.获取画布
        let canvas = document.getElementById('canvas')
        // 2.获取画布的上下文
        let ctx = canvas.getContext('2d')

        ctx.arc(250, 250, 200, 0, 2 * Math.PI, true)
        ctx.lineWidth = 2
        // 填充圆为金色
        ctx.fillStyle = 'gold'
        ctx.fill()
        // 着色
        ctx.strokeStyle = 'red'
        ctx.stroke()
    </script>
</body>

</html>